import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import { chatPageroutes } from "./routers/basePage/index";
import { newPage } from "./routers/settingsPage/index";

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'home',
    component: () => import('@/views/homePage/index.vue'),
    meta: {
      title: '首页'
    }
  },
  ...chatPageroutes,
  ...newPage
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})
//路由守卫
router.beforeEach((to, _, next) => {
  if (to.path === '/settingPage') {
    console.log("进入");

  }

  next()
})
router.afterEach(() => {
  console.log("哈哈");

})



export default router
